﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace WebApplication3
{
    public partial class WebForm1 : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            Calendar1.WeekendDayStyle.BackColor =
                System.Drawing.Color.AliceBlue;
        }

        protected void Calendar1_SelectionChanged(object sender, EventArgs e)
        {
            var a = Calendar1.SelectedDate;
            Label1.Text ="您选择的是 "+ a.Date.Year+"-"+a.Date.Month+"-"+ 
                a.Date.Day + " "+a.DayOfWeek ;
        }

        protected void Calendar1_DayRender(object sender, DayRenderEventArgs e)
        {
            if(e.Day.IsWeekend)
            {
                //e.Cell.BackColor = System.Drawing.Color.Red;
                e.Cell.Controls.Add(new LiteralControl("<br>休息"));
                e.Day.IsSelectable = false;
            }
        }
    }
}